Sets the state of a tray menu/item control.
TrayItemSetState ( controlID, state )
Parameters
controlID | The control identifier (controlID) as returned by a TrayCreateItem or TrayCreateMenu function. |
state | See the State table below. |
Return Value
Success: | Returns 1. |
Failure: | Returns 0. |
Remarks
State tableState | Value | Comments |
No Change | 0 | |
$TRAY_CHECKED | 1 | Menuitem will be checked |
$TRAY_UNCHECKED | 4 | Menuitem will be unchecked |
$TRAY_ENABLE | 64 | Menuitem will be enabled |
$TRAY_DISABLE | 128 | Menuitem will be greyed out |
$TRAY_FOCUS | 256 | Menuitem will be selected |
$TRAY_DEFAULT | 512 | Menuitem will be set as default menuitem |
Related
TrayItemGetState
Example
#Include <Constants.au3>
#NoTrayIcon
Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown.
$chkitem = TrayCreateItem("Check it")
TrayCreateItem("")
$checkeditem = TrayCreateItem("Checked")
TrayCreateItem("")
$exititem = TrayCreateItem("Exit")
TraySetState()
While 1
$msg = TrayGetMsg()
Select
Case $msg = 0
ContinueLoop
Case $msg = $chkitem
TrayItemSetState($checkeditem,$TRAY_CHECKED)
Case $msg = $exititem
ExitLoop
EndSelect
WEnd
Exit